
import { createWorker } from 'tesseract.js';
import path from 'path';

// 检查本地tessdata目录是否存在
const tessdataPath = path.join(process.cwd(), 'test', 'tessdata');
const worker = await createWorker({
  langPath: tessdataPath,
  gzip: false,
});

// 使用正确的字符串格式指定语言
await worker.loadLanguage('eng');
await worker.initialize('eng');

console.log('Tesseract.js 正常启动');
await worker.terminate();